<?php

/*
 * Niken Larasati
 * larasati.n@students.amikom.ac.id
 */

class pengguna extends CI_Controller {

    public function __construct() {
        parent::__construct();
    }

    function form_pengguna() {
        $this->template->load('halaman_v', 'form_pengguna_v'); 
        
    }

    function tambah() {
        if ($this->input->post('tambah') != NULL)
            ; {
            $data['id_pengguna'] = $this->input->post('id_pengguna');
            $data['nama'] = $this->input->post('nama');
            $data['alamat'] = $this->input->post('alamat');
            $data['no_telp'] = $this->input->post('no_telp');
            $data['username'] = $this->input->post('usernm');
            $data['passwd'] = $this->input->post('passwd');
            $data['level'] = $this->input->post('level');

            $this->load->model('umum_m');
            $this->umum_m->tambah('pengguna', $data); //'pengguna'nya ini nama tabel
            $this->template->load('halaman_v', 'form_pengguna_v');
        }
    }

//    function ubah() {
//        if ($this->input->post('ubah') !NULL);
//        {
//            //kasih required ya 
//            
//        }
//    }

    function ambil_data() {
        $this->load->model('pengguna_m');
        $data['data'] = $this->pengguna_m->ambil_data();
        $this->template->load('halaman_v', 'form_pengguna_v', $data);
    }

}

?>
